package java;

import java.io.PrintStream;
import java.util.function.Consumer;
import java.util.function.Supplier;

/**
 * @author:谢君臣
 * @Date:2021/8/5-21:24
 * @version:1.0
 * @function:
 */
public class ClassCastExceptionTest {
    public static void main(String[] args) {
        Person person = new Person();

        person.setName("张三");
        Supplier<String> getName = person::getName;
        Supplier<String> runnable = () -> person.getName();
        PrintStream ps = System.out;
        Consumer runnable1 = ps::println;
        System.out.println(getName.get());
        runnable1.accept(runnable.get());
    }
}
class Person{
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
class People{}
